package com.zm.demo.service;

import com.zm.demo.dto.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(value = "service-producer")
public interface DemoService {
    @GetMapping("test1")
    String test1();

    @GetMapping("add")
    int add(@RequestParam("a") int a, @RequestParam("b") int b);

    @GetMapping("user")
    User user();

    @PostMapping("post")
    String post();

    /**
     * post对象传参数 ，必须加上consumes ,不然会报com.netflix.client.ClientException异常
     * @param user
     * @return
     */
    @PostMapping(value = "post/param",consumes = "application/json")
    String postAndParam(@RequestBody User user);

    @GetMapping(value = "get/param",consumes = "application/json")
    String getAndParam(@RequestBody User user);
}
